<script type="text/html" data-template-name="ha-mqtt-climate">
  <div class="form-row">
      <label for="node-input-server" data-i18n="node-red-contrib-ha-mqtt/common:label.mqttServer"></label>
      <select id="node-input-server"></select>
  </div>
  <div class="form-row">
      <label for="node-input-device" data-i18n="node-red-contrib-ha-mqtt/common:label.deviceName"></label>
      <select type="text" id="node-input-device" data-i18n="[placeholder]node-red-contrib-ha-mqtt/common:label.deviceName"></select>
  </div>
  <div class="form-row">
      <label for="node-input-name" data-i18n="node-red-contrib-ha-mqtt/common:label.entityName"></label>
      <input type="text" id="node-input-name" data-i18n="[placeholder]node-red-contrib-ha-mqtt/common:label.entityName">
  </div>
  <div class="form-row">
      <label for="node-input-preset_mode" data-i18n="node-red-contrib-ha-mqtt/common:ioLabels.presetMode"></label>
      <input type="checkbox" id="node-input-preset_mode" style="width: auto;">
      <label for="node-input-preset_mode" style="width: auto; user-select: none;">Enable Preset Mode</label>
  </div>
  <div class="form-row">
      <a href="https://www.home-assistant.io/integrations/climate.mqtt/" target="_blank" style="color:blue;">
          <label for="node-input-config" data-i18n="node-red-contrib-ha-mqtt/common:label.config"></label>   
      </a> 
      <input type="text" id="node-input-config" data-i18n="[placeholder]node-red-contrib-ha-mqtt/common:label.config">          
  </div>
</script>
<script type="text/javascript">
RED.nodes.registerType('ha-mqtt-climate', {
  category: RED._("node-red-contrib-ha-mqtt/common:homeAssistantCategory"),
  color: '#C0DEED',
  icon: "font-awesome/fa-snowflake-o",
  paletteLabel: 'Climate',
  defaults: {
    server: { value: "", type: "mqtt-broker", required: true },
    device: { value: "", type: "ha-mqtt-device", required: true },
    name: { value: "", required: true },
    preset_mode: { value: false },
    config: { value: "" }
  },
  inputs: 1,
  outputs: 6,
  inputLabels: RED._("node-red-contrib-ha-mqtt/common:ioLabels.state"),
  outputLabels: [
    RED._("node-red-contrib-ha-mqtt/common:ioLabels.temperature"),
    RED._("node-red-contrib-ha-mqtt/common:ioLabels.mode"),
    RED._("node-red-contrib-ha-mqtt/common:ioLabels.swingMode"),
    RED._("node-red-contrib-ha-mqtt/common:ioLabels.fanMode"),
    RED._("node-red-contrib-ha-mqtt/common:ioLabels.targetHumidity"),
    RED._("node-red-contrib-ha-mqtt/common:ioLabels.presetMode")
  ],
  label: function () {
    return this.name || "climate";
  },
  oneditprepare: function () {
    $("#node-input-config").typedInput({ type: "json", types: ["json"] })
  }
});
</script>